package com.kou.backend.utils;

import cn.hutool.core.util.RandomUtil;

import java.security.SecureRandom;

/**
 * 随机数工具类
 *
 * @author: Kou
 * @since: 2023/8/29 20:30
 */
public class SecureRandomUtils {
    /**
     * 安全的生成4位随机数
     *
     * @return 4位随机数
     */
    public static String generateFourNum() {
        SecureRandom random = RandomUtil.getSecureRandom();
        int randomNumber = random.nextInt(9000) + 1000;
        return String.valueOf(randomNumber);
    }
}
